home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
pcv05n09.zip
/
GRPLAN.WBT
< prev
next >
Wrap
Text File
|
1993-06-13
|
5KB
|
129 lines
;; by Heather Stern
;; with help from Robin Selder, Mark Lawler, and Tod DeBie 5/29/92
;;;;; RunGroup - A Batch Runner Program by Heather Stern
;;; purpose: run all the items of a user-chosen group.
;;; method: use DDE conversation with the Program Manager or Norton Desktop
m="This is a batch file that will run all of the items in a user selected group."
Message ("NDW Group Runner",m)
Drop(m)
:DDEinit
channel = DDEInitiate("Progman","Progman") ; begin conversation
section ="group list" ; okay to terminate DDE if
; user cancels
; loop at this location until user enters a valid group or Cancels
:DDEtop
xx=DDERequest(channel,"PROGMAN")
xx=StrReplace(xx,Num2Char(13),",")
xx=StrReplace(xx,Num2Char(10),"")
group = ItemSelect("Select Group",xx,",")
;;; if user entered valid group, this will return data about it
;;; if invalid, NACK will be in the return string
items = DDERequest (channel, group)
nack = StrIndex(items, "NACK", 0, @FWDSCAN)
if nack <> 0 then goto error
; terminate conversation now that we have recieved our data
DDETerminate(channel)
section ="retrieve group data"
;;; Retrieve the number of objects from the first line.
; split the data into the first line and the rest of it.
endLine1 = StrIndex (items, Num2Char(13), 0, @FWDSCAN)
;;; trap for no CRs
if endLine1 == 0 then goto empty
;;; we have a CR, split at that
Line1 = StrSub (items, 1, endLine1 - 1)
Items = StrSub (items, endLine1 + 1, StrLen(items) - endLine1)
; now we use the first line and retrieve the number
; peel off last number and its comma
endLine1 = StrIndex (Line1, ",", StrLen(Line1), @BACKSCAN)
Line1 = StrSub (Line1, 1, endLine1 - 1)
; our result is next. Starting from its comma, to end of first line
endLine1 = StrIndex (Line1, ",", StrLen(Line1), @BACKSCAN)
numItems = StrSub (Line1, endLine1 + 1, StrLen(Line1) - endLine1)
;;; spot an empty group
if numItems == 0 then goto empty
;;; now that we know how many objects, retrieve commandline for each object
:ItemTop
if numItems == 0 then goto ItemBottom
; split the data into the first line and the rest of it.
endLine1 = StrIndex (items, Num2Char(13), 0, @FWDSCAN)
Line1 = StrSub (items, 1, endLine1 - 1)
Items = StrSub (items, endLine1 + 1, StrLen(items) - endLine1)
; our commandline is the second item. peel away the first.
cmdAt = StrIndex (Line1, ",", 0, @FWDSCAN)
Line1 = StrSub (Line1, cmdAt + 1, StrLen(Line1) - cmdAt)
cmdAt = StrIndex (Line1, ",", 0, @FWDSCAN)
cmdLine = StrSub (Line1, 1, cmdAt - 1)
; prune the quote marks
cmdLine = StrSub (Line1, 2, StrLen(cmdLine) - 2)
drop (cmdAt, Line1)
; let a subsection handle whether there are parameters for this program.
goto runItem
:ranItem
; done with this item, on to the next.
numItems = numItems - 1
goto ItemTop
:itemBottom
;;; we are now done!
Display (10, "Group Runner","All tasks are running now!")
Exit
:runItem
;;; seperated section - parse string from cmdLine area into 2 parameters for Run
if StrLen(cmdLine) == 0 then goto ranItem ; there was nothing to run
spaceAt = StrIndex (cmdLine, " ", 0, @FWDSCAN)
if spaceAt == 0 then goto noParms
Program = StrSub (cmdLine, 1, spaceAt - 1)
Parms = StrSub (cmdLine, spaceAt + 1, StrLen(cmdLine) - spaceAt)
drop (spaceAt, cmdLine)
; trap for invalid icon
if FileExist (Program) == @FALSE then goto noRun
Run (Program, Parms)
; if your task is slow to load a delaying action might be placed here.
Drop (Program, Parms)
goto ranItem
:noParms
drop (spaceAt)
; trap for invalid icon
if FileExist (cmdLine) == @FALSE then goto noRun
Run (cmdLine, "")
; if your task is slow to load a delaying action might be placed here.
Drop (cmdLine)
goto ranItem
:noRun
if IsDefined (cmdLine) then msg=cmdLine
if IsDefined (Program) then msg=Program
msg=StrCat("Object ", msg, " no longer exists.")
Display (10,"NDW Group Runner",msg)
Drop (msg)
goto ranItem
:error ; user chose invalid group name
Message ("Group Runner", "%group% group no longer exists")
goto DDEtop ; ask the user again
:empty
a="I cannot run a group with no icons."
b="Press OK to choose a new group or CANCEL to quit."
msg=StrCat(a,Num2Char(13),b)
Pause ("NDW Group Runner",msg)
drop (a,b,msg)
goto DDEinit ; only reach here if they wish to select another
; channel has terminated, so re-initiate
; Batch Runner CANCEL choices automatically branch here.
:cancel
if StrCmp(section,"group list") == 0 then DDETerminate (channel)
Exit